package com.ham.mud.commands.skills;

import com.ham.mud.ServerConnection;
import com.ham.mud.Targetable;
import com.ham.mud.characters.MudCharacter;
import com.ham.mud.state.PlayingState;

/**
 * Created by hlucas on Jun 27, 2011 at 1:19:25 PM
 */
public class FleeSkill extends Skill {
    @Override
    protected void useSkill(ServerConnection connection, Targetable targetable, ServerConnection enemy) {
        connection.changeState(new PlayingState(connection));
        connection.printSolo("You flee from " + ((MudCharacter)targetable).getName() + " like a ninny.");
        if(enemy != null) {
            enemy.changeState(new PlayingState(enemy));
            enemy.printSolo(connection.getPlayer().getName() + " flees from you like a ninny.");
        }
        //todo: move the player into a neighboring room
    }

    @Override
    public int getRounds() {
        return 1;
    }

    @Override
    protected String getCommandName() {
        return "flee";
    }

    @Override
    protected boolean isCombatSkill() {
        return true;
    }

    @Override
    public String getName() {
        return "Flee";
    }
}
